﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.Project
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.Project;

    public class ProjectUsers_Map : ClassMapping<ProjectUsers>
    {
        public ProjectUsers_Map()
        {
            //映射ID
            Id(x => x.r_id, map => map.Length(40));

            Property(x => x.is_valid);
            Property(x => x.create_date);

            Property(x => x.is_always);
            Property(x => x.role_name);

            //所属项目
            ManyToOne(x => x.Project, map =>
            {
                map.Column("proj_id");
                map.NotNullable(false);
            });

            //项目参与人
            ManyToOne(x => x.User, map =>
            {
                map.Column("user_id");
                map.NotNullable(false);
            });


            Table("t_project_users");

            //不进行创建
            //SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
